﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace SportingGoodsExhibitionSystem
{
    /// <summary>
    /// detailNotice.xaml 的交互逻辑
    /// </summary>
    public partial class detailNotice : Window
    {
        public detailNotice()
        {
            InitializeComponent();
        }

        string strCon = Properties.Resources.strCON;

        DateTime dt;

        public detailNotice(DateTime dt)
        {
            InitializeComponent();
            this.dt = dt;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SqlConnection con = new SqlConnection(strCon);
           
            SqlCommand cmd = new SqlCommand("select * from notice where time=@ti", con);
            cmd.Parameters.Add("@ti", SqlDbType.DateTime, 50).Value = dt;

            SqlDataAdapter read = new SqlDataAdapter(cmd);
            
            DataSet dataset = new DataSet();
            read.Fill(dataset);
            DataTable table = dataset.Tables[0];
            DataRowCollection rows = table.Rows;
            DataRow row = rows[0];
            string notice;
            notice= row["announce"].ToString();

            text.Text = notice;

        }
    }
}
